
import java.io.IOException;
import java.io.StringWriter;
 
import java.util.Scanner;
 
import junit.framework.Assert;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import junit.textui.TestRunner;


// -----------
// TestVoting
// -----------
 
public final class TestVoting extends TestCase {
// ----
// read
// ----
 
public void testRead () 
{
    MyBufferedReader in = new MyBufferedReader(System.in);
    String s;
}
 
// ----
// eval
// ----
 
public void testEval1 () 
{
int [] a = {1};
final int [] v = Primes.eval(a);
Assert.assertTrue(v == null);
}
 
public void testEval2 () 
{
int [] a = {8};
final int [] v = Primes.eval(a);
int [] b = {2, 2, 2, 2};
Assert.assertTrue(v[0] == b[0]);
Assert.assertTrue(v[1] == b[1]);
Assert.assertTrue(v[2] == b[2]);
Assert.assertTrue(v[3] == b[3]);
}
 
public void testEval3 () 
{
int [] a = {9};
final int [] v = Primes.eval(a);
int [] b = {3, 2, 2, 2};
Assert.assertTrue(v[0] == b[0]);
Assert.assertTrue(v[1] == b[1]);
Assert.assertTrue(v[2] == b[2]);
Assert.assertTrue(v[3] == b[3]);
}
 
public void testEval4 () 
{
int [] a = {10000000};
final int [] v = Primes.eval(a);
int [] b = {2, 2, 5, 9999991};
Assert.assertTrue(v[0] == b[0]);
Assert.assertTrue(v[1] == b[1]);
Assert.assertTrue(v[2] == b[2]);
Assert.assertTrue(v[3] == b[3]);
}
public void testEval5 () 
{
int [] a = {9999991};
final int [] v = Primes.eval(a);
int [] b = {3, 2, 13, 9999973};
Assert.assertTrue(v[0] == b[0]);
Assert.assertTrue(v[1] == b[1]);
Assert.assertTrue(v[2] == b[2]);
Assert.assertTrue(v[3] == b[3]);
}
 
// -----
// print
// -----
 
public void testPrinter () throws IOException 
{
final StringWriter w = new StringWriter();
int [] r = {2, 2, 2, 2};
int [] in = {8};
Primes.print(w, r, in);
Assert.assertTrue(w.toString().equals("2 2 2 2\n"));
}
 
// ----
// main
// ----
 
public static void main (String[] args) 
{
System.out.println("TestVoting.java");
TestRunner.run(new TestSuite(TestVoting.class));
System.out.println("Done.");}
}
 
